//1、编写 router/index.js文件
//引入 router
import { createMemoryHistory, createRouter } from 'vue-router'

//引入组件
import HomeView from '../views/HomeView.vue'
import MyView from '../views/MyView.vue'

//2、配置路由表信息
const routes = [
    {
        path: '/',          //访问的路劲
        name: 'home',       //名称
        //1.直接导入方式
        component: HomeView  //组件
    },
    {
        path: '/my',          //访问的路劲
        name: 'my',       //名称
        //1.直接导入方式
        component: MyView  //组件
    },
    {
        path: '/about',         //路劲
        name: 'about',          //名称
        //2. 懒加载的方式，访问的时候才加载
        component: () => import('../views/AboutView.vue') //组件
    }
]

//创建路由器
const router = createRouter({
    history: createMemoryHistory(),
    routes,
})
export { router }